//package com.vast.admin.controller;
//
//
//import com.baomidou.mybatisplus.core.metadata.IPage;
//import com.baomidou.mybatisplus.extension.api.ApiController;
//import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//import com.vast.admin.annotation.CurrentManager;
//import com.vast.admin.annotation.UseToken;
//import com.vast.common.core.domain.entity.SysUser;
//import com.vast.admin.entity.Menu;
//import com.vast.admin.service.MenuService;
//import com.vast.common.annotation.Log;
//import com.vast.common.core.domain.AjaxResult;
//import com.vast.common.constant.MessageCode;
//import com.vast.common.core.domain.Result;
//import io.swagger.annotations.*;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.*;
//
//import java.util.List;
//
///**
// * <p>
// *  前端控制器
// * </p>
// *
// * @author zhaohao
// * @since 2019-04-03
// */
//@Api(value="菜单操作相关的api",tags= {"菜单操作模块"})
//@RestController
//@RequestMapping("/manager/menu")
//public class MenuController extends ApiController {
//
//	@Autowired
//	private MenuService menuService;
//
////	@ApiOperation(value = "添加菜单", notes = "添加菜单")
////	@UseToken
////	@PostMapping("/addMenu")
////	@Log(title = "添加菜单")
////	public Result<Menu> addMenu(@RequestBody @ApiParam(name="Menu",value="Menu信息",required=true) Menu menu) {
////		if(menu != null) {
////			menu.setCreateTime(DateTime.now());
////			menu.setUpdateTime(DateTime.now());
////			menu.setValid(1);
////			menuService.save(menu);
////			return new Result<Menu>(MessageCode.SUCCESS, "添加成功", menu);
////		}else {
////			return new Result<Menu>(MessageCode.PARAM_ERROR, "参数错误");
////		}
////	}
////
////	@ApiOperation(value = "更新菜单", notes = "更新菜单")
////	@UseToken
////	@PostMapping("/updateMenu")
////	@Log(title = "更新菜单")
////	public Result<Menu> updateMenu(@RequestBody @ApiParam(name="Menu",value="Menu信息",required=true) Menu menu) {
////		if(menu != null) {
////			menu.setUpdateTime(DateTime.now());
////			menuService.saveOrUpdate(menu);
////			return new Result<Menu>(MessageCode.SUCCESS, "更新成功", menu);
////		}else {
////			return new Result<Menu>(MessageCode.PARAM_ERROR, "参数错误");
////		}
////	}
//
//	@ApiOperation(value = "获取所有菜单树", notes = "获取所有菜单树")
//	@UseToken
////	@Log(title = "获取所有菜单树")
//	@GetMapping("/getMenuTree")
//	public Result<IPage<Menu>> getAllMenu(@ApiParam(hidden = true)@CurrentManager SysUser manager, @ApiParam(hidden = true) Page<Menu> page) {
//		IPage<Menu> data = menuService.queryMenuTree(page);
//		return new Result<IPage<Menu>>(MessageCode.SUCCESS, "获取成功", data);
//	}
//
//	@ApiOperation(value = "获取导航菜单", notes = "获取导航菜单")
//	@UseToken
//	@GetMapping("/getNav")
////	@Log(title = "获取导航菜单")
//	public Result<List<Menu>> getNav(@ApiParam(hidden = true)@CurrentManager SysUser manager) {
//		List<Menu> data = menuService.getNav(manager);
//		return new Result<List<Menu>>(MessageCode.SUCCESS, "获取成功", data);
//	}
//
//	@ApiOperation(value = "获取权限", notes = "获取权限")
//	@UseToken
//	@GetMapping("/getPermissions")
//	@Log(title = "获取权限")
//	public Result<String> getPermissions(@ApiParam(hidden = true)@CurrentManager SysUser manager) {
//		String data = menuService.getPermissions(manager);
//		return new Result<String>(MessageCode.SUCCESS, "获取成功",data);
//	}
//
//	@ApiOperation(value = "添加或更新", notes = "添加或更新")
//	@UseToken
//	@PostMapping("/addOrUpdate")
//	@Log(title = "添加或更新菜单")
//	public Result<Menu> addOrUpdate(@ApiParam(hidden = true)@CurrentManager SysUser manager, @RequestBody @ApiParam(name="Menu",value="Menu信息",required=true) Menu menu) {
//		if(menu != null) {
//			boolean flag  = menuService.addOrUpdate(manager, menu);
//			if(flag){
//				return new Result<Menu>(MessageCode.SUCCESS, "添加成功", menu);
//			}else{
//				return new Result<Menu>(MessageCode.ERROR, "添加失败");
//			}
//		}else {
//			return new Result<Menu>(MessageCode.PARAM_ERROR, "参数错误");
//		}
//	}
//
//
//	@ApiOperation(value = "通过id获取详情", notes = "通过id获取详情")
//	@ApiImplicitParams({ @ApiImplicitParam(paramType = "header", name = "token", value = "登录获取的token", dataType = "String", required = true)})
//	@GetMapping("/info/{id}")
//	@UseToken
//	@Log(title = "通过id获取菜单详情")
//	public Result<Menu> info(@ApiParam(hidden = true) @CurrentManager SysUser manager,@PathVariable("id") Long id) {
//		if(id != null && id.longValue() > 0){
//			Menu managerInfo = menuService.info(manager,id);
//			if(managerInfo != null){
//				return new Result<Menu>(MessageCode.SUCCESS, "获取成功", managerInfo);
//			}else{
//				return new Result<Menu>(MessageCode.ERROR, "获取失败");
//			}
//		}
//		return new Result<Menu>(MessageCode.PARAM_ERROR, "id不能为空");
//	}
//
//	@ApiOperation(value = "删除数据", notes = "删除数据")
//	@UseToken
//	@Log(title = "删除菜单数据")
//	@DeleteMapping("/delete/{id}")
//	public Result<Boolean> delete(@ApiParam(hidden = true)@CurrentManager SysUser manager, @PathVariable("id") Long id) {
//		if(id != null && id.longValue() > 0) {
//			boolean flag  = menuService.delete(manager, id);
//			if(flag){
//				return new Result<Boolean>(MessageCode.SUCCESS, "删除成功");
//			}else{
//				return new Result<Boolean>(MessageCode.ERROR, "删除失败");
//			}
//		}else {
//			return new Result<Boolean>(MessageCode.PARAM_ERROR, "参数错误");
//		}
//	}
//
//
//	/**
//	 * 加载对应角色菜单列表树
//	 */
//	@GetMapping(value = "/roleMenuTreeselect/{roleId}")
//	public AjaxResult roleMenuTreeselect(@ApiParam(hidden = true)@CurrentManager SysUser manager, @PathVariable("roleId") Long roleId)
//	{
//		List<Menu> menus = menuService.selectMenuList(manager.getUserId());
//		AjaxResult ajax = AjaxResult.success();
//		ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
//		ajax.put("menus", menuService.buildMenuTreeSelect(menus));
//		return ajax;
//	}
//
//}
